<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生管理系统</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        html, body {
            width: 100%;
            height: 100%;
            background-color: aqua;
        }
        .head {
            border: 2px solid #ccc;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 60px;
            background-color: orange;
            color: aliceblue;
            position: relative;
            font-size: 35px;
        }
        .user {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: blueviolet;
            right: 10px;
            position: absolute;
            font-size: 20px;
        }
        .User {
            height: 80px;
            width: 60px;
            display: none;
            background-color: blueviolet;
            bottom: 30px;
            position: absolute;
            top: 60px;
            right: 0px;
            font-size: 10px !important;
        }
        .user:hover .User {
            display: block;
        }
        .user p {
            margin: 0;
            padding: 5px;
            text-align: center;
            cursor: pointer;
            transition: background 0.3s;
        }
        .container {
            display: flex;
            height: 100%;
        } 
        .emo1 {
            flex: 2;
            background-color: #c43939;
            padding: 20px;
        }
        .emo1 ul {
            list-style: none;
            margin-left: 15px;
            flex: 20;
        }
        .emo1 li {
            cursor: pointer;
            margin-bottom: 5px;
        }
        .emo2 {
            flex: 7;
            background-color: cyan;
            padding: 20px;
        } 
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: center;
        }
        th {
            background-color: #f2f2f2;
        }
        .button {
            padding: 5px 10px;
            background-color: red;
            color: white;
            border: none;
            cursor: pointer;
            margin: 2px;
        }
        .info {
            display: none;
            background-color: white;
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="head">学生管理系统
        <div class="user">四班
            <div class="User">
                <p onclick="togglePersonalInfo()">个人信息</p>
                <p>修改密码</p>
                <p>退出登录</p>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="emo1">
            <ul>
                <li>个人中心
                    <ul>
                        <li onclick="togglePersonalInfo()">个人信息</li>
                    </ul>
                </li>
                <li onclick="addFakeData()">班级信息</li>
                <li>学校信息</li>
                <li>成绩信息
                    <ul>
                        <li>课程成绩</li>
                    </ul>
                </li>
                <li>考勤信息</li>
            </ul>
        </div>
        <div class="emo2">
            <h2>学生信息</h2>
            <table id="studentTable">
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                    <th>职业</th>
                    <th>操作</th>
                </tr>
            </table>
            <div class="info" id="personalInfo">
                <h3>个人信息</h3>
                <p>姓名: 邹豪</p>
                <p>年龄: 19</p>
                <p>性别: 男</p>
                <p>职业: 学生</p>
                <p>学号: 012322100012</p>
            </div>
        </div>
    </div>
    <script>
        function addFakeData() {
            const table = document.getElementById('studentTable');
            table.innerHTML = `
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                    <th>职业</th>
                    <th>操作</th>
                </tr>
            `;
            for (let i = 1; i <= 50; i++) { // 添加100行假数据
                const row = table.insertRow();
                row.innerHTML = `
                    <td>${i}</td>
                    <td>学生${i}</td>
                    <td>${18 + Math.floor(Math.random() * 5)}</td>
                    <td>${Math.random() > 0.5 ? '男' : '女'}</td>
                    <td>学生</td>
                    <td>
                        <button class="button" onclick="editRow(this)">修改</button>
                        <button class="button" onclick="deleteRow(this)">删除</button>
                    </td>
                `;
            }
            // 隐藏个人信息
            document.getElementById('personalInfo').style.display = 'none';
        }

        function deleteRow(button) {
            const row = button.parentElement.parentElement;
            row.parentElement.removeChild(row);
        }

        function editRow(button) {
            const row = button.parentElement.parentElement;
            alert(`修改学生: ${row.cells[1].innerText}`); // 示例: 可以弹出修改窗口或逻辑
        }

        function togglePersonalInfo() {
            const info = document.getElementById('personalInfo');
            const studentTable = document.getElementById('studentTable');
            info.style.display = (info.style.display === 'none' || info.style.display === '') ? 'block' : 'none';
            studentTable.parentElement.style.display = 'table'; // 显示学生表格
        }
    </script>
</body>
</html>
<script src="test-1.js"></script>
<script>
    $(function(){
        $("li:has(ul)").click(function(e){
            if(this == e.target){
                if($(this).children().is(":hidden")){
                    $(this).css("list-style-image", "url(minus.gif)")
                    .children().show();
                } else {
                    $(this).css("list-style-image", "url(plus.gif)")
                    .children().hide();
                }
            }
            return false;
        }).css("cursor", "pointer").click();
        $("li:not(:has(ul))").css({
            "cursor": "default",
            "list-style-image": "none"
        });
    });
</script>